load("@fbcode_macros//build_defs/lib:rust_oss.bzl", "rust_oss")
load("@fbsource//tools/build_defs:rust_binary.bzl", "rust_binary")
load("@fbsource//tools/target_determinator/macros:ci.bzl", "ci")
load("//eden/mononoke/facebook:lib.bzl", "tokio_dependency_test")

oncall("scm_server_infra")

rust_binary(
    name = "mononoke",
    srcs = glob(["server/src/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "server"},
    labels = [
        ci.heavyweight(),
    ],
    deps = ([
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:clap",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:openssl",
        "fbsource//third-party/rust:tracing",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/secure_utils:secure_utils",
        "//eden/mononoke/features/cache_warmup:cache_warmup",
        "//eden/mononoke/cmdlib:cmdlib_logging",
        "//eden/mononoke/cmdlib:environment",
        "//eden/mononoke/cmdlib/mononoke_app:mononoke_app",
        "//eden/mononoke/cmdlib/sharding:executor_lib",
        "//eden/mononoke/cmdlib/sharding_ext:sharding_ext",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_api:mononoke_api",
        "//eden/mononoke/server/repo_listener:repo_listener",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/scm/lib/clientinfo:clientinfo",
    ] + ([] if rust_oss.is_oss_build() else [
        "//eden/mononoke/features/pushrebase:pushrebase_client",
    ])) + ["fbsource//third-party/rust:tokio"],
)

tokio_dependency_test(
    name = "tokio_check",
    rule = ":mononoke",
)
